export const LAYOUT_MODE_VERTICAL: UnionKey.ThemeLayoutMode = 'vertical';
export const LAYOUT_MODE_HORIZONTAL: UnionKey.ThemeLayoutMode = 'horizontal';
export const LAYOUT_MODE_VERTICAL_MIX: UnionKey.ThemeLayoutMode = 'vertical-mix';
export const LAYOUT_MODE_HORIZONTAL_MIX: UnionKey.ThemeLayoutMode = 'horizontal-mix';
type TypeListItem = {
	label: string;
	value: string | number;
	[key: string]: any;
};

type TypeObject = {
	[key: string]: TypeListItem;
};

export type OperationType =
	| 'APPROVE'
	| 'ADD'
	| 'UPDATE'
	| 'DELETE'
	| 'VIEW'
	| 'DETAIL'
	| 'EXPORT'
	| 'IMPORT'
	| 'PRINT'
	| 'EDIT'
	| 'PWD';

/** 操作类型 */
export const operationTypeList = {
	ADD: {
		label: '新增',
		value: 'add'
	},
	UPDATE: {
		label: '修改',
		value: 'update'
	},
	DELETE: {
		label: '删除',
		value: 'delete'
	},
	VIEW: {
		label: '查看',
		value: 'view'
	},
	DETAIL: {
		label: '详情',
		value: 'detail'
	},
	EXPORT: {
		label: '导出',
		value: 'export'
	},
	IMPORT: {
		label: '导入',
		value: 'import'
	},
	PRINT: {
		label: '打印',
		value: 'print'
	},
	EDIT: {
		label: '编辑',
		value: 'edit'
	},
	APPROVE: {
		label: '审批',
		value: 'approve'
	},
	PWD: {
		label: '修改密码',
		value: 'pwd'
	}
};

/** 是否 */
export const operationTypeBoolean = {
	YES: {
		label: '是',
		value: 1
	},
	NO: {
		label: '否',
		value: 0
	}
};

/** 转换成valueEnum类型 */
export const typeToValueEnum = (typeList: TypeObject) => {
	const result: Record<number | string, { text: string; [key: string]: any }> = {};
	Object.values(typeList).forEach(item => {
		result[item.value] = { text: item.label };
	});
	return result;
};
